// app.js
App({
    onLaunch() {
        // 展示本地存储能力
        const logs = wx.getStorageSync('logs') || []
        logs.unshift(Date.now())
        wx.setStorageSync('logs', logs)

    },
    getUserProfile: function() {
        console.log('调用登陆接口')
        var that = this;
        wx.getUserProfile({
            desc: '用于完善会员资料', // 声明获取用户个人信息后的用途，后续会展示在弹窗中，请谨慎填写
            success: (res) => {
                // console.log(res)
                const userinfor = res.userInfo
                wx.setStorageSync('userInfo', userinfor);
                wx.setStorageSync('hasUserInfo', true);
            },
            fail(res) {
                console.log(res)
            }

        })
    },
    getUserInfo: function() {
        console.log('调用登陆接口')
        var that = this;
        wx.getUserInfo({
            success: (res) => {
                const userinfor = res.userInfo
                wx.setStorageSync('userInfo', userinfor);
                wx.setStorageSync('hasUserInfo', true);
            },
            fail(res) {
                console.log(res)
                wx.setStorageSync('hasUserInfo', false);
            }

        })
    },
    globalData: {
        userInfo: null
    }
})